//
//  CGInfoSchoolFrame.m
//  SchoolClient
//
//  Created by mac on 15/12/9.
//  Copyright © 2015年 mac. All rights reserved.
//

#import "CGInfoSchoolFrame.h"

@implementation CGInfoSchoolFrame
-(void)setProduct:(CGInfoSchool *)product{
    _product = product;
    /** 计算CGInfoCompanyJobCell的高度 **/
    
    //招聘标题Frame
    CGFloat titleX = 10;
    CGFloat titleY = 10;
    CGFloat titleW = SCREEN_WIDTH - 20;
    NSMutableDictionary *titleDic = [NSMutableDictionary dictionary];
    titleDic[NSFontAttributeName] = [UIFont systemFontOfSize:16];
    CGRect titleRect = [_product.title boundingRectWithSize:CGSizeMake(titleW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:titleDic context:nil];
    titleRect.origin.x = titleX;
    titleRect.origin.y = titleY;
    _titleLabelF = titleRect;
    
    //招聘学校Frame
    CGFloat schoolX = titleX;
    CGFloat schoolY = CGRectGetMaxY(_titleLabelF) + 10;
    CGFloat schoolW = titleW;
    NSMutableDictionary *schoolDic = [NSMutableDictionary dictionary];
    schoolDic[NSFontAttributeName] = [UIFont systemFontOfSize:15];
    CGRect schoolRect = [_product.name boundingRectWithSize:CGSizeMake(schoolW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:schoolDic context:nil];
    schoolRect.origin.x = schoolX;
    schoolRect.origin.y = schoolY;
    _schoolLabelF = schoolRect;
    
    //招聘时间Frame
    CGFloat timeTitleX = titleX;
    CGFloat timeTitleY = CGRectGetMaxY(_schoolLabelF) + 10;
    CGFloat timeTitleW = 65;
    CGFloat timeTitleH = 14;
    _timeTitleLabelF = CGRectMake(timeTitleX, timeTitleY, timeTitleW, timeTitleH);
    
    //时间内容Frame
    CGFloat tiemContentX = CGRectGetMaxX(_timeTitleLabelF);
    CGFloat tiemContentY = timeTitleY;
    CGFloat tiemContentW = SCREEN_WIDTH - 85;
    CGFloat tiemContentH = timeTitleH;
    _timeContentLabelF = CGRectMake(tiemContentX, tiemContentY, tiemContentW, tiemContentH);
    
    //Cell的高度
    _cellHeight = CGRectGetMaxY(_timeTitleLabelF) + 10;
    
}

@end
